package com.yckj.day07;

/**
 * TODO
 *
 * @author shengyuee
 * @version 1.0
 * 2025/7/24 11:36
 */
public class Teacher  extends  Person{
    private String tid;
    private double salary;

    public String getTid() {
        return tid;
    }

    public void setTid(String tid) {
        this.tid = tid;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    @Override
    public String toString() {
        return "Teacher{" +
                "tid='" + tid + '\'' +
                ", salary=" + salary +
                '}';
    }

    public void teach(){
        System.out.println("教学");
    }

    /**
     * 方法的重写
     *  在不同的类中，子类的方法名与父类相同，参数列表相同，返回类型相同，子类的方法修饰符比父类方法修饰父更宽松
     */
    @Override // 检测是否是重写
    public void sleep(){
        System.out.println("子类重写了sleep()");
    }
}
